<?php
function error_td($error) {
  echo  '<tr>
          <td class="error" colspan="2">'
          . $error .
          '</td>
        </tr>';
}

//$hacker = new Hacker();
?>
<style type="text/css">

td.error {
  color: red;
  font-size:13px;
  text-align:center;
}
body {
   font-family:verdana,arial;
}
table.canvas_table
{
  empty-cells: show;
  border-collapse: collapse;
  border: thin inset rgb(100,100,100);  
  background-color: rgb(255,255,255);
  align:center;
  vertical-align: middle;
  width:100%;
}
input.button
{
  border: thin outset rgb(100,100,100);
  background-color: rgb(220,220,220)
}
h2
{
  text-align:center;
  font-family:verdama;
  font-size:16px;
  overflow:hidden;
}
th
{
  font-family:verdama;
  font-size:14px;overflow:hidden;
}
a:hover {
  text-decoration:underline;
}
a {
  color:#3B5998;
  text-decoration:none;
}
div.table_title {
  text-align:center;
  font-family:verdama;
  font-size:20px;
  overflow:hidden;
  height:25px;
	vertical-align: bottom;
}

div.msg {
  text-align:center;
  font-family:verdama;
  font-size:14px;
  overflow:hidden;
  height:16px;
	vertical-align: bottom;
	background-color: yellow;
}
div.template_body {
  vertical-align: top;
  width:100%;
}
</style>
<div class="template_body">
<?php
if($saved) {
?>
<div class="msg">
  <?=$lang['myinfo']['saved'];?>
</div>
<?php
}
?>

<div class="table_title">
<?=$lang['myinfo']['myinfo_title'];?>
</div>
<form action="<?=WS_HOME_DIR;?>myinfo_iframe.php?<?=$_SERVER['QUERY_STRING'];?>" method="post" enctype="multipart/form-data">
  <table class="canvas_table" id="app">
     <tr>
       <td width="100">
         <?=$lang['myinfo']['name'];?>
       </td>
       <td>
         <?=$name;?>
       </td>
     </tr>
     <tr>
       <td>
         <?=$lang['myinfo']['email'];?>
       </td>
       <td>
         <input style="width:95%" type="text" name="email" value="<?=@$fill['email'];?>"/>
       </td>
     </tr>
<?php
  if(isset($errors['email'])) {
    error_td($errors['email']);    
  }
?>
     <tr>
       <td>
         <?=$lang['myinfo']['nickname'];?>
       </td>
       <td>
         <input style="width:95%" type="text" name="nickname" value="<?=@$fill['nickname'];?>"/>
       </td>
     </tr>
<?php
  if(isset($errors['nickname'])) {
    error_td($errors['nickname']);    
  }
?>
     <tr>
       <td>
         <?=$lang['myinfo']['hackathon'];?>
       </td>
       <td>
          <select style="width:50%" name="hackathon">
<?php
          $hackathons = HackathonDAO::getList();
//          $h = new Hackathon();
          foreach($hackathons as $h) {        
            echo "<option value='" . $h->getId() . "'" . (($h->getId() == @$fill['hackathon'])?' selected':'') . ">" . $h->getLocation() . ' - ' .$h->getDate() . "</option>\n";
          }
?>
          </select>
       </td>
     </tr>
<?php
  if(isset($errors['hackathon'])) {
    error_td($errors['hackathon']);    
  }
?>
<!--      <tr>
       <td>
         <?=$lang['myinfo']['cv'];?>
       </td>
       <td>
         <input style="width:95%" type="file" name="cv"/>
       </td>
     </tr>
<?php
  if(isset($errors['cv'])) {
    error_td($errors['cv']);    
  }
?> -->
     <tr>
       <td>
         <?=$lang['myinfo']['work_or_university'];?>
       </td>
       <td>
         <input style="width:95%" type="text" name="work" value="<?=@$fill['work'];?>"/>
       </td>
     </tr>
<?php
  if(isset($errors['work'])) {
    error_td($errors['work']);    
  }
?>
     <tr>
       <td>
         <?=$lang['myinfo']['extra_info'];?>
       </td>
       <td>
         <div class="app_description">
	         <textarea style="height:50px; width: 95%" name="extra_info"><?=@$fill['extra_info'];?></textarea>
         </div>
       </td>
     </tr>
<?php
  if(isset($errors['extra_info'])) {
    error_td($errors['extra_info']);    
  }
?>
     <tr>
       <td colspan="2" style="text-align:center;">
         <input type="submit" name="submit" value="<?=$lang['myinfo']['update'];?>">
       </td>
     </tr>
  </table>
</form>
  
</div>